﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="user_login" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>系统登录</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="../css/ss01.css">
    <script language="JScript" src="../js/Function.js"></script>
    <script language="JScript" src="../js/myCheck.js"></script>
    <script language="javascript">
        window.onload = useridFieldInit;

        function useridFieldInit() {
	        var userid = "";
	        userid=getCookie("ncms_userid");

	        document.getElementById("user_id").value = userid;
        }
        
        function getCookie(name){
              var strCookie=document.cookie;
              var arrCookie=strCookie.split("; ");
              for(var i=0;i<arrCookie.length;i++){
                    var arr=arrCookie[i].split("=");
                    if(arr[0]==name)return arr[1];
              }
              return "";
        }
        
        function addCookie(name,value,expireHours){
              var cookieString=name+"="+escape(value);
              //判断是否设置过期时间,0=永不过期
              if(expireHours>0){
                     var date=new Date();
                     date.setTime(date.getTime+expireHours*3600*1000);
                     cookieString=cookieString+"; expire="+date.toGMTString();
              }
              document.cookie=cookieString;
        }

        function deleteCookie(name){
               var date=new Date();
               date.setTime(date.getTime()-10000);
               document.cookie=name+"=v; expire="+date.toGMTString();
        }

        function setCookie() {
	        var expireDate = new Date();
	        expireDate.setMonth(expireDate.getMonth()+6);
        	
	        var userid = document.getElementById("user_id").value;
	        document.cookie = "ncms_userid=" + userid + ";expires=" + expireDate.toGMTString();
        }
        
        function saveCookie()
        {
            if(document.getElementById("remember").checked==true)
            {
                setCookie();
            }
        }
    </script>
    <script type="text/javascript" language="javascript">
        function chk()
        {
			if(CheckText(form1.user_id,"登录名",20)==false) return false;
            
            saveCookie();
            
			return true;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div>
            <table border="0" cellpadding="4" cellspacing="0">
                <tr>
                    <td>登录名：</td>
                </tr>
                <tr>
                    <td>
                        <asp:TextBox ID="user_id" runat="server" Width=160></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>登录密码：</td>
                </tr>
                <tr>
                    <td>
                        <asp:TextBox ID="password" runat="server" TextMode="Password" Width=160></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>验证码：</td>
                </tr>
                <tr>
                    <td>
                        <asp:TextBox ID="vercode" runat="server" Width=160></asp:TextBox>&nbsp;&nbsp;<asp:Image id="vcode" runat="server" ImageAlign="AbsBottom"></asp:Image>
                    </td>
                </tr>
                <tr>
                    <td><input id="remember" name="remember" type="checkbox"/><font style="color: darkgray;">在这台电脑上记住我</font></td>
                </tr>
                <tr>
                    <td>
                        <asp:Button ID="btnLogin" runat="server" Text="进入" OnClick="btnLogin_Click" />
                        <font style="font-size: 10pt; color: red;"><asp:Literal ID="msg" runat="server"></asp:Literal></font>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    </form>
</body>
</html>
